<?php
require_once("../../../class2.php");
require_once("../includes/require_all.php");

if(USERNAME=="Mnementh"){
	$srch= array("<specialen ' >",	"<specialen '>");
	$rplc= array("`",				"`");
	$filename="";
	
	$tbl_name=$_GET['to'];
	$q= "SELECT * FROM {$tbl_name}_text";
	$game= mysql_query($q);
	
	file_put_contents("$tbl_name.txt","");
	
	WHILE ($repl= mysql_fetch_array($game)){
		if($filename!=$repl['file_name']){
			$filename=$repl['file_name'];
			$filed= "\nFILENAME<:|:>$filename";
			file_put_contents("$tbl_name.txt",$filed,FILE_APPEND);
		}
		$en= trim(str_replace($srch,$rplc,$repl['english']));
		$bg= trim(str_replace($srch,$rplc,$repl['content']));
		$code= trim($repl['text_id']);
		$rowed= "\n$code<:|:>$en<:|:>$bg";
		file_put_contents("$tbl_name.txt",$rowed,FILE_APPEND);
	}
}

?>